<template>
  <div class="header">
    <h1>我是Header</h1>
    <p>Count的值是{{ count }}</p>
    <p>价格是{{ price }}</p>
    <button @click="increment">累加count的值</button>
    <button @click="incrementN({ n: 3 })">count的值每次加n</button>
    <button @click="incrementWait()">等一等再加</button>
  </div>
</template>

<script>
import { mapMutations, mapState } from "vuex";
export default {
  name: "Header",
  mounted() {
    // console.log(this);
    /* console.log(
      mapMutations(["increment", "incrementN"]).incrementN.call(this, { n: 5 })
    ); */
  },
  computed: {
    ...mapState(["count", "price"]),
  },
  methods: {
    ...mapMutations(["increment", "incrementN","incrementWait"]),

  },
};
</script>

<style scoped>
.header {
  margin: 30px;
  background: yellowgreen;
}
</style>